package com.lqkj.maptest.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author Linm
 * @title
 * @date 2021/8/9 10:31
 */

public class ResultVo {
    /**
     * 返回码
     */
    private Integer code;

    /**
     * 返回信息
     */
    private String message;

    /**
     * 返回的数据
     */
    private Object data;

    /**
     * 数据的数量
     */
    private Integer count;


    private ResultVo(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    private ResultVo(Integer code, String message, Object data, Integer count) {
        this.code = code;
        this.message = message;
        this.data = data;
        this.count = count;
    }

    private ResultVo(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public ResultVo(){

    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }


    public static ResultVo success(String message){
        return new ResultVo(200,message);
    }

    public static ResultVo fail(Integer code, String message){
        return new ResultVo(code, message);
    }

    public static ResultVo success(Object data, String message, Integer count){
        return new ResultVo(200, message, data, count);
    }

    public static ResultVo success(Object data, String message){
        return new ResultVo(200, message, data);
    }

    public static ResultVo fail(Integer code, String message, Integer count) {
        return new ResultVo(code, message, count);
    }
}
